<! -- -*- tcl -*- doctools manpage
   -->
<html><head>
<title>midistreamdll - Wrapper for the Win32 Midi stream API </title>
</head>
<! -- Generated from file 'midistreamdll.man' by tcllib/doctools with format 'html'
   -->
<! -- Copyright &copy; 2007-2008 Jos Decoster &lt;jos.decoster@gmail.com&gt;
   -->
<! -- CVS: $Id$ midistreamdll.n
   -->

<body>
<h1> midistreamdll(n) 0.4  &quot;Wrapper for the Win32 Midi stream API&quot;</h1>
<h2><a name="name">NAME</a></h2>
<p>
<p> midistreamdll - Wrapper for the Win32 Midi stream API




<h2><a name="synopsis">SYNOPSIS</a></h2>
<p>
package require <b>Tcl 8.5</b><br>
<br><table border=1 width=100% cellspacing=0 cellpadding=0><tr            bgcolor=lightyellow><td bgcolor=lightyellow><table 0 width=100% cellspacing=0 cellpadding=0><tr valign=top ><td ><a href="#1"><b class='cmd'>midistreamdll::devs</b> </a></td></tr>
<tr valign=top ><td ><a href="#2"><b class='cmd'>midistreamdll::open</b> <i class='arg'>deviceId</i></a></td></tr>
<tr valign=top ><td ><a href="#3"><i class='arg'>midiStreamId</i> <strong>close</strong></a></td></tr>
<tr valign=top ><td ><a href="#4"><i class='arg'>midiStreamId</i> <strong>out</strong> <i class='arg'>headerId</i></a></td></tr>
<tr valign=top ><td ><a href="#5"><i class='arg'>midiStreamId</i> <strong>pause</strong></a></td></tr>
<tr valign=top ><td ><a href="#6"><i class='arg'>midiStreamId</i> <strong>play</strong></a></td></tr>
<tr valign=top ><td ><a href="#7"><i class='arg'>midiStreamId</i> <strong>position</strong></a></td></tr>
<tr valign=top ><td ><a href="#8"><i class='arg'>midiStreamId</i> <strong>set</strong> <i class='arg'>option</i> <i class='arg'>value</i></a></td></tr>
<tr valign=top ><td ><a href="#9"><i class='arg'>midiStreamId</i> <strong>short</strong> <i class='arg'>byte0</i> ?<i class='arg'>byte1</i>? ?<i class='arg'>byte2</i>?</a></td></tr>
<tr valign=top ><td ><a href="#10"><i class='arg'>midiStreamId</i> <strong>stop</strong></a></td></tr>
<tr valign=top ><td ><a href="#11"><b class='cmd'>midistreamdll::header</b> </a></td></tr>
<tr valign=top ><td ><a href="#12"><i class='arg'>headerId</i> <strong>add</strong> <i class='arg'>eventType</i> <i class='arg'>deltaTime</i> <i class='arg'>eventData</i></a></td></tr>
<tr valign=top ><td ><a href="#13"><i class='arg'>headerId</i> <strong>destroy</strong></a></td></tr>
</table></td></tr></table>
<h2><a name="description">DESCRIPTION</a></h2>
<p>

<p>

This page describes the Tcl <strong>midistreamdll</strong> package, a wrapper for the
Win32 Midi stream API. Commands to query the available Midi devices, open a Midi
stream device and send Midi data to it are discussed here.

<p>

The <strong>midistreamdll</strong> package adds the namespace midistreamdll to the Tcl
interpreter in which it is loaded. In this namespace, the main commands to
work with midi stream are created:

<dl>
<dt>midistreamdll::devs<dd>
<dt>midistreamdll::open<dd>
<dt>midistreamdll::header<dd>
</dl>

<h2><a name="midistreamdlldevs">midistreamdll::devs</a></h2>
<p>

<dl>

<dt><a name="1"><b class='cmd'>midistreamdll::devs</b> </a><dd>


This command returns a list of names of the available Midi devices. 

</dl>

<h2><a name="midistreamdllopen">midistreamdll::open</a></h2>
<p>

<dl>

<dt><a name="2"><b class='cmd'>midistreamdll::open</b> <i class='arg'>deviceId</i></a><dd>


This command will open the specified Midi stream device and returns a unique
Midi stream device id. This id should be used to manipulate the Midi device
later on. A Midi device is specified as an integer index in the list of Midi
devices as obtained with the <b class='cmd'>midistreamdll::devs</b> command.

<br><br>
<dt><a name="3"><i class='arg'>midiStreamId</i> <strong>close</strong></a><dd>


Closes the Midi stream devices.

<br><br>
<dt><a name="4"><i class='arg'>midiStreamId</i> <strong>out</strong> <i class='arg'>headerId</i></a><dd>


Stream the specified Midi header, which must be created with the 
<b class='cmd'>midistreamdll::header</b> command, to the Midi stream device.

<br><br>
<dt><a name="5"><i class='arg'>midiStreamId</i> <strong>pause</strong></a><dd>


Pauses the Midi stream device.

<br><br>
<dt><a name="6"><i class='arg'>midiStreamId</i> <strong>play</strong></a><dd>


Starts playback of the Midi stream device.

<br><br>
<dt><a name="7"><i class='arg'>midiStreamId</i> <strong>position</strong></a><dd>


Returns the current position in the stream being sequenced as Midi ticks.

<br><br>
<dt><a name="8"><i class='arg'>midiStreamId</i> <strong>set</strong> <i class='arg'>option</i> <i class='arg'>value</i></a><dd>


Set the specified option. Known options are:

<br><br>
<dl>

<dt><strong>-timediv</strong> integer<dd>

Set the number of ticks per beat.

<br><br>
<dt><strong></strong><dd>

</dl>

<dt><a name="9"><i class='arg'>midiStreamId</i> <strong>short</strong> <i class='arg'>byte0</i> ?<i class='arg'>byte1</i>? ?<i class='arg'>byte2</i>?</a><dd>


Immediately plays a short event on the Midi device.

<br><br>
<dt><a name="10"><i class='arg'>midiStreamId</i> <strong>stop</strong></a><dd>


Stops playback of the Midi stream device.

</dl>

<h2><a name="midistreamdllheader">midistreamdll::header</a></h2>
<p>

<dl>

<dt><a name="11"><b class='cmd'>midistreamdll::header</b> </a><dd>


This commands creates a new Midi header, suitable for use with the Midi stream
<b class='cmd'>out</b> command and returns a unique header id. This id should be used to
manipulate the Midi header later on.

<br><br>
<dt><a name="12"><i class='arg'>headerId</i> <strong>add</strong> <i class='arg'>eventType</i> <i class='arg'>deltaTime</i> <i class='arg'>eventData</i></a><dd>


Adds the specified event data to the Midi header with specified
delta-time. Known event types are:

<br><br>
<dl>

<dt><strong>event</strong> deltaTime byteList<dd>

Adds event specified as a list of bytes to the Midi header. When an empty list
is specified, a nop event is added. For 1 up to 3 bytes, the data is added as a
short event. For more bytes, the data is added as a long event.

<br><br>
<dt><strong>long</strong> deltaTime byteList<dd>

Adds event specified as a list of bytes to the Midi header. 

<br><br>
<dt><strong>nop</strong> deltaTime<dd>

Adds nop event to the Midi header.

<br><br>
<dt><strong>short</strong> deltaTime byte0 ?byte1 ?byte2??<dd>

Adds one, two or three bytes to the Midi header as short event.

<br><br>
<dt><strong>tempo</strong> deltaTime tempo<dd>

Adds tempo event to the Midi header.

<br><br>
<dt><strong></strong><dd>

</dl>

<dt><a name="13"><i class='arg'>headerId</i> <strong>destroy</strong></a><dd>


Destroys the Midi header.

</dl>


<h2><a name="keywords">KEYWORDS</a></h2>
<p>
midi, stream
<h2><a name="copyright">COPYRIGHT</a></h2>
<p>
Copyright &copy; 2007-2008 Jos Decoster &lt;jos.decoster@gmail.com&gt;<br>
</body></html>

